<%--
  Created by IntelliJ IDEA.
  User: gule
  Date: 2020/5/19
  Time: 10:20 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--为啥一定要加这句话才能显示数据，太tm坑了--%>
<%@ page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>resume list</title>
    <!--
	SpringMVC处理静态资源：
	1. 为什么会有这样的问题:
	优雅的 REST 风格的资源URL 不希望带 .html 或 .do 等后缀
	若将 DispatcherServlet 请求映射配置为 /,
	则 Spring MVC 将捕获 WEB 容器的所有请求, 包括静态资源的请求, SpringMVC 会将他们当成一个普通请求处理,
	因找不到对应处理器将导致错误。
<%--	2. 解决: 在 SpringMVC 的配置文件中配置 <mvc:default-servlet-handler/>--%>
 -->
    <script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".delete").click(function () {
                var href = $(this).attr("href");
                $("form").attr("action", href).submit();
                return false;
            });
        })
    </script>
</head>
<body>
<form action="" method="POST">
    <input type="hidden" name="_method" value="DELETE">
</form>
<c:if test="${empty resumeList}">
    There is no resume info.
</c:if>
<table border="1" cellpadding="10" cellspacing="0">
    <tr>
        <th>Id</th>
        <th>Address</th>
        <th>Name</th>
        <th>Phone</th>
        <th>Edit</th>
        <th>Delete</th>
    </tr>
    <c:forEach items="${resumeList}" var="resume">
        <tr>
            <td>${resume.id}</td>
            <td>${resume.address}</td>
            <td>${resume.name}</td>
            <td>${resume.phone}</td>
            <td><a href="getResume?username=admin&id=${resume.id}">Edit</a></td>
            <td><a class="delete" href="deleteResume?username=admin&id=${resume.id }">Delete</a></td>
        </tr>
    </c:forEach>
</table>

<br><br>

<a href="getResume?username=admin&id=0">Add New Employee</a>
</body>
</html>
